//节流：n秒内无论被触发多少次，回调函数只执行一次
export function throttle(func, wait){
    let timer = null
    return function(){
        let context = this;
        let args = arguments;
        if(!timer){
            func.apply(context, args)
            timer = setTimeout(function(){
                timer = null;
            },wait)
        }
    }
}